﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using BusinessLayer.RegInfo.Entities;
using DBHelper;

namespace BusinessLayer.RegInfo
{
    public class PartnerBL
    {
        public Partner GetByPartnerCode(string partnerCode)
        {
            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);
            adapter.AddParameter("@PartnerCode", partnerCode);

            var list = adapter.GetList<Partner>("sp_Partner_Select_By_PartnerCode", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit);
            return list.FirstOrDefault();
        }

        public List<Partner> GetAll()
        {
            var adapter = new BaseDAO(DbConfig.DbRegInfoConnectionString);

            var list = adapter.GetList<Partner>("sp_Partner_Select_All", CommandType.StoredProcedure, CustomConnectionState.CloseOnExit);
            return list;
        }
    }
}
